package com.liuhx.controller;

import com.liuhx.entity.ModelsEntity;
import com.liuhx.service.ModelsService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by liuhx on 2017/7/13.
 */
@RequestMapping("models")
@RestController
public class ModelsController {
    @Resource
    ModelsService modelsService;

    @RequestMapping("insert")
    public Map insert(@RequestBody List<ModelsEntity> modelsEntityList)
    {
        modelsService.insert(modelsEntityList);
        Map map = new HashMap();
        map.put("code",200);
        return map;
    }
    @RequestMapping("find")
    public List<ModelsEntity> find(int brandId)
    {
        return  modelsService.findById(brandId);
    }
}
